package com.linkwings.projectsimple.pojo;

// Generated 2011-9-10 1:10:00 by Hibernate Tools 3.4.0.CR1

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * Book generated by hbm2java
 */
@Entity
@Table(name = "book", catalog = "project_sample")
public class Book implements java.io.Serializable {

	private Integer id;
	private String bookName;
	//private Integer catid;
	private Bookcat bookcat;
	
	public Book() {
	}

	public Book(String bookName) {
		this.bookName = bookName;
	}



	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "book_name", nullable = false, length = 45)
	public String getBookName() {
		return this.bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName;
	}
   /* @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    @JoinColumn(name = "catid")*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "catid")
	public Bookcat getBookcat() {
		return bookcat;
	}

	public void setBookcat(Bookcat bookcat) {
		this.bookcat = bookcat;
	}

	/*@Column(name = "catid")
	public Integer getCatid() {
		return this.catid;
	}

	public void setCatid(Integer catid) {
		this.catid = catid;
	}*/

}
